Bump rust-lightning to include trampoline changes#825
Bump rust-lightning to include trampoline changes#825carlaKC wants to merge 1 commit intolightningdevkit:mainfrom
Conversation
|
👋 Thanks for assigning @tnull as a reviewer! |
src/event.rs
Outdated
| /// A set of multiple htlcs all associated with same forward. | ||
| #[derive(Debug, Clone, PartialEq, Eq)] | ||
| #[cfg_attr(feature = "uniffi", derive(uniffi::Record))] | ||
| pub struct HTLCSet(Vec<HTLCLocator>); |
There was a problem hiding this comment.
Interested in some feedback here 🙏
To use default_value to fill in legacy fields when the new field isn't present, we need to implement Readable/Writeable for Vec<HTLCLocator>. We can't do this because we don't own the trait or the type (orphan rule).
The solution I've gone with here is to use a wrapper struct and pull in the code we have in impl_for_vec in LDK.
Alternatives would be:
- Don't use
default_value, and write manualReadable/Writeableimpls forEventso that we can manually fill the legacy values (I can't find a way to do it within macros). - Just use
required_vecand don't fill legacy values (seems bad).
src/event.rs
Outdated
| // For backwards compatibility, write the first prev/next_htlc to our legacy fields. This | ||
| // allows use to downgrade with some information loss about the remaining htlcs. |
There was a problem hiding this comment.
Not sure what the project's philosophy is for backwards compatibility, so just gone with what I would have done in LDK - happy to do something else if it's preferred!
There was a problem hiding this comment.
Yeah, while we def. want to get to support downgrades at some point, we currently don't. So we can just drop this extra logic as long as we're positive backwards compatibility during upgrades is ensured.
76e3d44 to
dd42f5f
Compare
Cargo.toml
Outdated
| # TODO: need to push branch to Jeff's fork? | ||
| bitcoin-payment-instructions = { git = "https://github.com/carlaKC/bitcoin-payment-instructions", rev = "c22c9b836b70d4c915dd28701e11083a8b558d56" } |
There was a problem hiding this comment.
@tnull had been doing most of the updates until recently when my PRs (and others) started breaking LDK Node. I ended up setting up a remote to his branch and based mine off of it. Personally, I'd be fine if you want to do something similar, as that at least gives us a common history for bitcoin-payment-instructions bumps.
Cargo.toml
Outdated
| #lightning-transaction-sync = { path = "../rust-lightning/lightning-transaction-sync" } | ||
| #lightning-liquidity = { path = "../rust-lightning/lightning-liquidity" } | ||
| #lightning-macros = { path = "../rust-lightning/lightning-macros" } | ||
| lightning-macros = { path = "../rust-lightning/lightning-macros" } |
| pub node_id: Option<PublicKey>, | ||
| } | ||
|
|
||
| impl_writeable_tlv_based!(HTLCLocator, { |
There was a problem hiding this comment.
Hmm, I'd really like to avoid duplicating upstream's serialization logic, which always risks to get out-of-sync. Can we rather also impl From<Vec<HTLCLocator>> for Vec<LdkHTLCLocator> and use upstream's write? I admit that is also not great, but maybe preferable to duplicating even more logic?
There was a problem hiding this comment.
I admit that is also not great, but maybe preferable to duplicating even more logic?
Given this a shot, it's a little unwieldy but I agree probably preferable to duplication.
src/event.rs
Outdated
|
|
||
| /// A set of multiple htlcs all associated with same forward. | ||
| #[derive(Debug, Clone, PartialEq, Eq)] | ||
| pub struct HTLCSet(pub Vec<HTLCLocator>); |
There was a problem hiding this comment.
Why do we need this additional newtype? I think even for bindings we should be able to leave it as Vec<HTLCLocator>?
There was a problem hiding this comment.
This was to get around the orphan rule for serialization (we can't implement a trait we don't own - Readable/Writeable - for a type we don't own - Vec<T>).
If we don't need backwards compat, then we don't need default_value and can clean up a whole bunch of things including this 👌
src/event.rs
Outdated
| (5, node_id, option), | ||
| }); | ||
|
|
||
| impl From<lightning::events::HTLCLocator> for HTLCLocator { |
There was a problem hiding this comment.
nit: Please import the upstream type as LdkHTLCLocator, which is the usual pattern.
src/event.rs
Outdated
| // For backwards compatibility, write the first prev/next_htlc to our legacy fields. This | ||
| // allows use to downgrade with some information loss about the remaining htlcs. |
There was a problem hiding this comment.
Yeah, while we def. want to get to support downgrades at some point, we currently don't. So we can just drop this extra logic as long as we're positive backwards compatibility during upgrades is ensured.
dd42f5f to
e60ce2e
Compare
Depends on #824.
Also needs the following patch on top of 2026-02-ldk-node-base in
bitcoin-payment-instructions.